<template>
  <view class="myBox">
    <view class="topTitle flex-sp-center">
      <view class="Title">
        医联•互联网医院
        <view class="">开启美好的一天</view>
      </view>
      <view class="flex-center-center">
        <view class="ScanCode flex-center-center">
          <image src="@/static/my/scan.png" mode=""></image>
          扫一扫
        </view>
        <view class="tz">
          <image src="@/static/CommonTools/tz.png" mode=""></image>
        </view>
      </view>
    </view>
    <view class="doctor">
      <view class="" @click="goinfo('pages/my/MyProfile/MyProfile')">
        <view class="title flex-center">
          <image src="@/static/my/tx.png" mode=""></image>
          <view class="nameBox">
            <view class="name">
              {{ data.doctorName }}
              <text>{{ data.titleName }}</text>
              <text>{{ data.departName }}</text>
            </view>
            <view class="typeBox">
              <text>{{ data.levelName }}</text>
              {{ data.hospitalName }}
            </view>
            <view class="setUp">点击设置资料</view>
          </view>
          <view class="code">
            <image src="@/static/my/code.png" mode=""></image>
          </view>
        </view>
      </view>
    </view>
    <view class="nav flex-sp-center">
      <view class="">
        <view class="">
          {{ data.myPatientCount }}
        </view>
        我的患者
      </view>
      <view class="">
        <view class="">
          {{ data.patientConsultCount }}
        </view>
        患者咨询
      </view>
      <view class="">
        <view class="">
          {{ data.patientAppointCount }}
        </view>
        患者预约
      </view>
      <view class="">
        <view class="">
          {{ data.consultationFrequency }}
        </view>
        会诊次数
      </view>
    </view>
    <view class="module flex-sp-center">
      <view class="left">
        <image
          @click="goinfo('pages/ConsultationRoom/index')"
          class=""
          src="@/static/index/zs.png"
          mode="aspectFit"
        ></image>
      </view>
      <view class="right">
        <image
          @click="goinfo('pages/ConsultationRoom/index')"
          src="@/static/index/ggzs.png"
          mode="aspectFit"
        ></image>
        <view class="flex-sp-center">
          <image src="@/static/index/yy.png" mode="aspectFit"></image>
          <image
            src="@/static/index/hz.png"
            mode="aspectFit"
            @click="goinfo('TUIKit/components/TUIConversation/index')"
          ></image>
        </view>
      </view>
    </view>
    <view class="currency_card mt_30 list">
      <view
        class="flex-sp-center"
        @click="goinfo('pages/ConsultationRoom/TodayAppointment/TodayAppointment')"
      >
        <image src="@/static/index/list1.png" mode=""></image>
        <view class="">
          <view class="title flex-sp-center">今日接诊</view>
          <view class="flex-sp-center listText">待接诊 {{ data.todayConsultCount }}</view>
        </view>
        <uni-icons type="right" size="16"></uni-icons>
      </view>
      <view class="flex-sp-center">
        <image src="@/static/index/list3.png" mode=""></image>
        <view class="">
          <view class="title flex-sp-center">今日会诊</view>
          <view class="flex-sp-center listText">会诊中 {{ data.todayConsultationNum }}</view>
        </view>
        <uni-icons type="right" size="16"></uni-icons>
      </view>
      <view class="flex-sp-center">
        <image src="@/static/index/list2.png" mode=""></image>
        <view class="">
          <view class="title flex-sp-center">今日预约</view>
          <view class="flex-sp-center listText">已预约 {{ data.todayAppointNum }}</view>
        </view>
        <uni-icons type="right" size="16"></uni-icons>
      </view>
    </view>
  </view>
</template>

<script>
import { getDoctorStatic } from '@/api/user'
import { createConversation } from '@/utils/TIM'

export default {
  data() {
    return {
      data: {},
    }
  },
  onLoad() {
    this.getDoctorStatic()
  },
  methods: {
    // 创建会话
    handleCreateConversation(userID) {
      createConversation(userID)
    },
    getDoctorStatic() {
      getDoctorStatic().then(res => {
        this.data = res.data
      })
    },
    goinfo(e, id) {
      if (id) {
        uni.navigateTo({
          url: `/${e}?id=${id}`,
        })
      } else {
        uni.navigateTo({
          url: `/${e}`,
        })
      }
    },
  },
}
</script>

<style lang="less" scopde>
.myBox {
  min-height: 100vh;
  background-image: url(@/static/my/myBg.png);
  background-size: 100% 726rpx;
  background-repeat: no-repeat;
  padding: 51rpx 30rpx;
  box-sizing: border-box;

  .list {
    padding-top: 36rpx;

    & > view {
      margin-bottom: 62rpx;

      &:last-child {
        margin-bottom: 23rpx;
      }

      & > view {
        flex: 1;

        .title {
          font-weight: bold;
          font-size: 30rpx;
          color: #333333;
        }

        .num {
          display: inline-block;
          min-width: 29rpx;
          height: 28rpx;
          background: #ff4d3d;
          border-radius: 14rpx;
          font-weight: 500;
          font-size: 22rpx;
          color: #ffffff;
          text-align: center;
          line-height: 28rpx;
        }

        .listText {
          margin-top: 20rpx;
          font-weight: 500;
          font-size: 28rpx;
          color: #999999;
        }
      }
    }

    image {
      width: 95rpx;
      height: 95rpx;
      margin-right: 18rpx;
    }
  }

  .module {
    .left {
      image {
        width: 333rpx;
        height: 320rpx;
      }
    }

    .right {
      width: 338rpx;

      image {
        width: 338rpx;
        height: 147rpx;
      }

      & > view {
        image {
          width: 161rpx;
          height: 155rpx;
        }
      }
    }
  }

  .nav {
    height: 123rpx;
    padding: 0 30rpx;

    & > view {
      font-weight: 500;
      font-size: 26rpx;
      color: #666666;

      & > view {
        font-weight: 500;
        font-size: 34rpx;
        color: #333333;
        text-align: center;

        image {
          width: 42rpx;
          height: 45rpx;
          margin-right: 18rpx;
        }
      }
    }
  }

  .doctor {
    width: 690rpx;
    min-height: 182rpx;
    border-radius: 30rpx;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-around;

    & > view {
      width: 100%;
    }

    .title {
      .code {
        image {
          width: 63rpx;
          height: 60rpx;
        }
      }

      .nameBox {
        flex: 1;
      }

      .name {
        font-weight: bold;
        font-size: 32rpx;
        color: #333333;

        text {
          font-weight: 500;
          font-size: 24rpx;
          color: #666666;
          margin-left: 19rpx;
        }
      }

      image {
        width: 118rpx;
        height: 118rpx;
        margin-right: 21rpx;
      }
    }

    .typeBox {
      margin-top: 5rpx;

      text {
        display: inline-block;
        width: 63rpx;
        height: 33rpx;
        background: #def7ed;
        border-radius: 10rpx;
        font-weight: 500;
        font-size: 22rpx;
        color: #23cc88;
        text-align: center;
        line-height: 33rpx;
        margin-right: 10rpx;
      }
    }

    .setUp {
      margin-top: 5rpx;
      font-weight: 500;
      font-size: 24rpx;
      color: #999999;
    }
  }

  .topTitle {
    .Title {
      font-weight: 800;
      font-size: 34rpx;
      color: #333333;

      view {
        font-weight: 500;
        font-size: 24rpx;
        color: #999999;
      }
    }

    .tz {
      image {
        width: 60rpx;
        height: 68rpx;
      }
    }

    .ScanCode {
      width: 145rpx;
      height: 60rpx;
      border-radius: 35rpx;
      border: 2px solid #3e6efe;
      font-weight: 500;
      font-size: 24rpx;
      color: #3e6efe;
      margin-right: 32rpx;

      image {
        width: 24rpx;
        height: 24rpx;
        margin-right: 9rpx;
      }
    }
  }
}
</style>
